﻿using System.Net;
using System.Net.Mail;

namespace PwManager
{
    public class EmailHelper
    {
        public static void SendEmailMsg(string address, string subject, string body)
        {
            using (var client = new SmtpClient())
            using (var mail = new MailMessage())
            {
                var from = new MailAddress("hebaidong1990@126.com");
                var to = new MailAddress(address);
                mail.From = from;
                mail.To.Add(to);
                mail.Subject = subject;
                mail.Body = body;

                client.Host = "smtp.126.com";
                client.EnableSsl = true;
                client.UseDefaultCredentials = false;
                client.Credentials = new NetworkCredential("hebaidong1990@126.com", "zhf920922");

                client.Send(mail);
            }
        }
    }
}
